﻿@using HotelManageSystem.Models
@model IEnumerable<GodownentryModel>
@{
    ViewBag.Title = "ShowGodownentry";
    Layout = "~/Views/Shared/_LayoutWarehouse.cshtml";
}
@section Head {
    <link href= "@Url.Content("~/Content/TelerikGrid.css")"rel="stylesheet" type="text/css" />
}
@{
    
        Html.Telerik()
            .Grid(Model)
            .Name("Grid")
            .DataKeys(keys => keys.Add(g => g.ID))
            .ToolBar(commands => commands.Custom().Text("添加入库单").Action("Creat", "Godownentry"))
            .DataBinding(dataBinding => dataBinding.Ajax()
                                            .OperationMode(GridOperationMode.Client)
                                            .Select("TelerikAjax", "Godownentry")
                                            .Update("Update", "Godownentry")
                                            .Delete("Delete", "Godownentry"))
            .Sortable(sorting => sorting
                                     .SortMode(GridSortMode.SingleColumn)
                                     .OrderBy(sortOrder => sortOrder
                                                               .Add((string) ViewData["sortMember"])
                                     ))
            .Pageable(paging => paging
                                    .Style(GridPagerStyles.NextPreviousAndNumeric)
                                    .Position(GridPagerPosition.Bottom)
                                    .PageTo((int) ViewData["currentPage"])
                                    .PageSize(5))
            .Columns(columns =>
                         {
                             columns.Bound(x => x.ID).Visible(false);
                             columns.Bound(o => o.GodownentryID).Width(280).ReadOnly().Title("入库单号");
                             columns.Bound(o => o.Stockprice).Width(100).Format("{0:c}").Title("单价");
                             columns.Bound(o => o.Count).Width(100).Title("数量");
                             columns.Bound(o => o.Total).Width(100).Format("{0:N}").Title("合计");
                             columns.Bound(o => o.Datetime).Width(130).Format("{0:d}").Title("时间");
                             columns.Bound(o => o.Billproducer).Width(100).Title("制单人");
                             columns.Bound(o => o.ProductName).Width(100).Title("货品名");
                             columns.Bound(o => o.ProductProviderName).Width(100).Title("供应商");
                             columns.Bound(o => o.EmployeeName).Width(100).Title("审核人");
                             columns.Bound(o => o.WarehouseName).Width(100).Title("仓库号");
                             columns.Command(commands =>
                                                 {
                                                     //commands.Select();
                                                     //commands.Edit();
                                                     commands.Custom("EditGodownentry")
                                                         .Text("编辑")
                                                         .SendDataKeys(true)
                                                         
                                                         .Action("Edit", "Godownentry")
                                                        ;
                                                     commands.Delete();
                                                 }).Width(200);
                         }
            )
            
            //.Editable(editing => editing.Mode(GridEditMode.PopUp))
            .Groupable()
            .Filterable()
            .Scrollable(scrolling => scrolling.Height(300))
            .Selectable()
            .Render();





}
